package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.WcQuestionDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity WcQuestion and its DTO WcQuestionDTO.
 */
@Mapper(componentModel = "spring", uses = {WcProductMapper.class, })
public interface WcQuestionMapper extends EntityMapper <WcQuestionDTO, WcQuestion> {

    @Mapping(source = "wcProduct.id", target = "wcProductId")
    @Mapping(source = "wcProduct.name", target = "wcProductName")
    WcQuestionDTO toDto(WcQuestion wcQuestion); 

    @Mapping(source = "wcProductId", target = "wcProduct")
    WcQuestion toEntity(WcQuestionDTO wcQuestionDTO); 
    default WcQuestion fromId(Long id) {
        if (id == null) {
            return null;
        }
        WcQuestion wcQuestion = new WcQuestion();
        wcQuestion.setId(id);
        return wcQuestion;
    }
}
